#!/bin/sh
#
# How to use this test
# --------------------
#
# * Get a working Windows OS on your network
# * Install strawberry perl version with msi
#   http://www.susan.org/downloads/depkgs-mingw32/strawberry-perl-5.10.1.0.msi
# * Install the latest version of Susan FD
# * Copy or make accessible (Network share, VirtualBox share)
#     regress/scripts/regress-win32.pl
# * Execute the script on the Windows box
#     perl regress-win32.pl
# * Run this script with the proper config settings about WIN32
#
TestName="win32-systemstate-test"
. scripts/functions

scripts/cleanup
scripts/copy-test-confs
cp scripts/win32-susan-dir.conf bin/susan-dir.conf

URL=http://$WIN32_ADDR:8091
wget -qO $tmp/stop.log "$URL/stop"
wget -qO $tmp/update.log "$URL/set_director_name?name=$HOST-dir;pass=$WIN32_PASSWORD"
wget -qO $tmp/start.log "$URL/start"

start_test

cat <<END_OF_DATA >${cwd}/tmp/bconcmds
@output
messages
@$out ${cwd}/tmp/log1.out
status client=$WIN32_CLIENT
label storage=File volume=TestVolume001
run job=SystemstateJob storage=File yes
wait
messages
@#
@# now do a restore
@#
@$out ${cwd}/tmp/log2.out
restore where=/ storage=File
cd @SYSTEMSTATE
m Reg*
done
yes
wait
messages
quit
END_OF_DATA

run_susan
check_for_zombie_jobs storage=File
stop_susan

check_two_logs
end_test
